home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000091_icon-group-sender _Sat Mar 22 16:50:45 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Sat, 22 Mar 1997 16:12:10 MST
To: icon-group@cs.arizona.edu
Date: 22 Mar 1997 16:50:45 GMT
From: espie@drakkar.ens.fr (Marc Espie)
Message-Id: <5h12l5$6m3$1@nef.ens.fr>
Organization: Ecole Normale Superieure, Paris
Sender: icon-group-request@cs.arizona.edu
References: <33338AEF.420@anu.edu.au>
Subject: Re: Problem with Program
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1123
In article <33338AEF.420@anu.edu.au>,
Stuart Robinson <Stuart.Robinson@anu.edu.au> wrote:
>Hello.
>
>I've run into a problem with a program that I've written and I was
>hoping that someone would tell what is wrong. I'm sure it's silly and
>stupid but I am a newcomer to programming in general and Icon in
>particular.
>
>This short little program is meant to read a line and write either (1)
>a tab followed by the line or (2) simply the line. It should do (1)
>if the line either contains "{Q" or follows a line with "{Q";
>otherwise, it should do (2).
Relax your strategy, it will work better:
procedure main()
while line := read() do
if find("{Q", line) then
{
write("\t"||line)
write("\t"||read())
}
else
write(line)
end
- using string scanning is more confusing than anything in that context.
- you have to use two write() for the comments case, as read() can fail.
--
[nosave]<http://www.eleves.ens.fr:8080/home/espie/index.html>
microsoft network is EXPLICITLY forbidden to redistribute this message.
`Seiza no matataki kazoe, uranau koi no yuku e.'
Marc Espie (Marc.Espie@ens.fr)